/*
 * Avatar.cpp
 *
 *  Created on: 2013.01.10.
 *      Author: Thg
 */

#include "Trace.h"

#include "Avatar.h"

Avatar::Avatar(Vector pos) :
	GameMember(pos)
{
	traceMethod();
}

void
Avatar::processInput(Application* input)
{
	traceMethod();
}

const Vector&
Avatar::eye()
{
	traceMethod();
	return getPosition();
}

Vector
Avatar::steering(Application* input)
{
	traceMethod();
	if (input->getKeyStatus(KeyUp)) return up() * (-1.0f);
	if (input->getKeyStatus(KeyDown)) return up();
	if (input->getKeyStatus(KeyLeft)) return up() % head();
	if (input->getKeyStatus(KeyRight)) return head() % up();

	/*if (input->mousePressed)
	{*/
		float width = input->getWindowWidth();
		float height = input->getWindowHeight();
		float dx = (2 * input->getMousePosX() - width) / width;
		float dy = (2 * input->getMousePosY() - height) / height;
		return ((head() % up()) * dx + up() * dy) * input->getMouseSensitivity();
	//}
	return Vector(0, 0, 0);
}
